package rhc.discribute.signal.signalTouch;

import java.util.Collection;
import java.util.Map;

import rhc.discribute.access.signal.ReceiveMsg;
import rhc.discribute.node.host.Host;
import rhc.discribute.signal.SignalTouch;
import rhc.discribute.signal.signalInterface.ReceiveMsgSignal;
import rhc.discribute.signal.signalInterface.SendMsgSignal;

public class SendMsgSignalTouch implements SignalTouch<SendMsgSignal> {

	@Override
	public void touchSignal(Collection<SendMsgSignal> signalInterfaces, Map<String, Object> signalObject) {
		if(null == signalObject){
			return;
		}
		
		Host toHost=(Host) signalObject.get(SendMsgSignal.TO_HOST);
		String message=(String) signalObject.get(SendMsgSignal.MESSAGE);
		int tryCount=(int) signalObject.get(SendMsgSignal.TRY_COUNT);
		
		for(SendMsgSignal sms:signalInterfaces){
			sms.process(toHost, message,tryCount);
		}
	}

}
